/*
 * @描述: 权限管理、系统管理API
 * @版权所有: 广东国星科技有限公司
 * @商业授权: www.mscodecloud.com
 */
import { stringify } from 'qs';
import request from '@/utils/request';

/** 用户API开始 */

export async function querySysUser(params = {}) {
  return request(`/api/admin/sysuser/querySysUser?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryUsername() {
  return request('/api/admin/sysuser/queryUsername', {
    method: 'GET'
  });
}

export async function deleteSysUser(params) {
  return request('/api/admin/sysuser/deleteSysUser', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysUser(params) {
  return request('/api/admin/sysuser/addSysUser', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysUser(params) {
  return request('/api/admin/sysuser/updateSysUser', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysUser(params) {
  return request('/api/admin/sysuser/exportSysUser', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

export async function updateSysUserDetail(params) {
  return request('/api/account/sysuserdetail/updateSysUserDetail', {
    method: 'PUT',
    data: {
      ...params
    }
  });
}

export async function updatePassword(params) {
  return request('/api/account/sysuserdetail/updatePassword', {
    method: 'PUT',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function updateSysUserInfo(params) {
  return request('/api/account/sysuserdetail/updateSysUserInfo', {
    method: 'PUT',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

/** 用户API结束 */
/** 角色API开始 */

export async function querySysRole(params = {}) {
  return request(`/api/admin/sysrole/querySysRole?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryRoleName() {
  return request('/api/admin/sysrole/queryRoleName', {
    method: 'GET'
  });
}

export async function queryRoleCode() {
  return request('/api/admin/sysrole/queryRoleCode', {
    method: 'GET'
  });
}

export async function queryRoleNameCheckbox() {
  return request('/api/admin/sysrole/queryRoleNameCheckbox', {
    method: 'GET'
  });
}

export async function deleteSysRole(params) {
  return request('/api/admin/sysrole/deleteSysRole', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysRole(params) {
  return request('/api/admin/sysrole/addSysRole', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysRole(params) {
  return request('/api/admin/sysrole/updateSysRole', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysRole(params) {
  return request('/api/admin/sysrole/exportSysRole', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

/** 角色API结束 */
/** 参数API开始 */

export async function querySysParam(params = {}) {
  return request(`/api/admin/sysparam/querySysParam?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteSysParam(params) {
  return request('/api/admin/sysparam/deleteSysParam', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysParam(params) {
  return request('/api/admin/sysparam/addSysParam', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysParam(params) {
  return request('/api/admin/sysparam/updateSysParam', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysParam(params) {
  return request('/api/admin/sysparam/exportSysParam', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

/** 参数API结束 */
/** 字典API开始 */

export async function querySysDict(params = {}) {
  return request(`/api/admin/sysdict/querySysDict?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteSysDict(params) {
  return request('/api/admin/sysdict/deleteSysDict', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysDict(params) {
  return request('/api/admin/sysdict/addSysDict', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysDict(params) {
  return request('/api/admin/sysdict/updateSysDict', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysDict(params) {
  return request('/api/admin/sysdict/exportSysDict', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

export async function querySysDictTree() {
  return request('/api/admin/sysdict/querySysDictTree', {
    method: 'GET'
  });
}

/** 字典API结束 */
/** 机构API开始 */

export async function querySysOrg(params = {}) {
  return request(`/api/admin/sysorg/querySysOrg?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteSysOrg(params) {
  return request('/api/admin/sysorg/deleteSysOrg', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysOrg(params) {
  return request('/api/admin/sysorg/addSysOrg', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysOrg(params) {
  return request('/api/admin/sysorg/updateSysOrg', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysOrg(params) {
  return request('/api/admin/sysorg/exportSysOrg', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

export async function querySysOrgTree() {
  return request('/api/admin/sysorg/querySysOrgTree', {
    method: 'GET'
  });
}

export async function queryOrgType() {
  return request('/api/admin/sysorg/queryOrgType', {
    method: 'GET'
  });
}

/** 机构API结束 */
/** 菜单API开始 */

export async function querySysMenu(params = {}) {
  return request(`/api/admin/sysmenu/querySysMenu?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryDataFieldByMenuCode(params = {}) {
  return request(`/api/admin/sysmenu/queryDataFieldByMenuCode?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryMenuIdByRoleId(params = {}) {
  return request(`/api/admin/sysmenu/queryMenuIdByRoleId?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryMenuButtonByRoleCode(params = {}) {
  return request(`/api/admin/sysmenu/queryMenuButtonByRoleCode?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function querySysMenuTree() {
  return request('/api/admin/sysmenu/querySysMenuTree', {
    method: 'GET'
  });
}

export async function queryMenuButtonCheckbox() {
  return request('/api/admin/sysmenu/queryMenuButtonCheckbox', {
    method: 'GET'
  });
}

export async function queryCheckedMenuButton(params = {}) {
  return request(`/api/admin/sysmenu/queryCheckedMenuButton?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function querySysMenuButtonTree() {
  return request('/api/admin/sysmenu/querySysMenuButtonTree', {
    method: 'GET'
  });
}

export async function deleteSysMenu(params) {
  return request('/api/admin/sysmenu/deleteSysMenu', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function deleteDataField(params) {
  return request('/api/admin/sysmenu/deleteDataField', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysMenu(params) {
  return request('/api/admin/sysmenu/addSysMenu', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function authorizeMenuToRole(params) {
  return request('/api/admin/sysmenu/authorizeMenuToRole', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function authorizeMenuButtonToRole(params) {
  return request('/api/admin/sysmenu/authorizeMenuButtonToRole', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function authorizeMenuDataToRole(params) {
  return request('/api/admin/sysmenu/authorizeMenuDataToRole', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function updateSysMenu(params) {
  return request('/api/admin/sysmenu/updateSysMenu', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysMenu(params) {
  return request('/api/admin/sysmenu/exportSysMenu', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

/** 菜单API结束 */
/** 区域API开始 */

export async function querySysRegion(params = {}) {
  return request(`/api/admin/sysregion/querySysRegion?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteSysRegion(params) {
  return request('/api/admin/sysregion/deleteSysRegion', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addSysRegion(params) {
  return request('/api/admin/sysregion/addSysRegion', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateSysRegion(params) {
  return request('/api/admin/sysregion/updateSysRegion', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportSysRegion(params) {
  return request('/api/admin/sysregion/exportSysRegion', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

export async function querySysRegionTree() {
  return request('/api/admin/sysregion/querySysRegionTree', {
    method: 'GET'
  });
}

export async function queryRegionType() {
  return request('/api/admin/sysregion/queryRegionType', {
    method: 'GET'
  });
}

/** 区域API结束 */
/** 消息通知API开始 */

export async function queryNotification(params = {}) {
  return request(`/api/notification/notification/queryNotification?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryMyNotification(params = {}) {
  return request(`/api/notification/notification/queryMyNotification?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryHeadNotification(params = {}) {
  return request(`/api/notification/notification/queryHeadNotification?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteNotification(params) {
  return request('/api/notification/notification/deleteNotification', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addNotification(params = {}) {
  return request(`/api/notification/notification/addNotification?${stringify(params.expand)}`, {
    method: 'POST',
    data: {
      ...params.body
    }
  });
}

export async function updateNotification(params = {}) {
  return request(`/api/notification/notification/updateNotification?${stringify(params.expand)}`, {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function queryNotificationType() {
  return request('/api/notification/notification/queryNotificationType', {
    method: 'GET'
  });
}

export async function queryNotificationPriority() {
  return request('/api/notification/notification/queryNotificationPriority', {
    method: 'GET'
  });
}

/** 消息通知API结束 */
